package org.lc.platform.base.constant;

/**
 * @author lc
 * @ClassName: AuthConstant
 * @Description: 鉴权常量类
 * @since 2024-02-12
 */
public class AuthConstant {
    /**
     * REFRESH
     */
    public static final String REFRESH = "refresh";
    /**
     * jwt 密钥存储key
     */
    public static final String JWT_SET = "jwk_set";

    /**
     * JWT存储权限前缀
     */
    public static final String AUTHORITY_PREFIX = "ROLE_";


    /**
     * JWT存储权限属性
     */
    public static final String AUTHORITY_CLAIM_NAME = "authorities";


    /**
     * Basic认证前缀
     */
    public static final String JWT_TOKEN_PREFIX_BASIC = "Basic ";


    /**
     * Bearer认证前缀
     */
    public static final String JWT_TOKEN_PREFIX_BEARER = "Bearer ";
    /*
     * clientSign,客户端信息，防止被拦截
     */
    public final static String CLIENT_SIGN = "clientSign";
    /*
     * JWT存储信息USERNAME
     */
    public final static String USER_NAME = "username";


    /*
     * JWT存储信息USERID
     */
    public final static String USER_ID = "userId";

    /*
     * JWT存储信息nickName
     */
    public final static String NICK_NAME = "nickName";

    /*
     * JWT存储信息Acls
     */
    public final static String ACLS = "acls";

    /*
     * JWT存储用户所属平台ID
     */
    public final static String CLIENTID = "clientId";
    /*
     * JWT存储信息APIS
     */
    public final static String APIS = "apis";

    /*
     * JWT存储信息roles
     */
    public final static String ROLES = "roles";
    /*
     * JWT存储信息password
     */
    public final static String PASSWORD = "password";

    /**
     * 请求头里面的User
     */
    public final static String HEADER_USER = "x-user";


    /*
     * 自定义异常分隔符
     */
    public final static String EXCEPTION_SPLIT = "<--->";


    /*
     * oauth2 自带异常错误提示
     */
    public final static String PASSWORD_ERROR = "用户名或密码错误";

    /*
     * oauth2 自带异常错误提示
     */
    public final static String UNSUPPORTED_GRANT_TYPE = "unsupported_grant_type";

    /*
     * oauth2 自带异常错误提示
     */
    public final static String UNSUPPORTED_CLIENT = "unauthorized_client";

    /*
     * oauth2 一般refresh_token 过期
     */
    public final static String INVALID_GRANT = "invalid_grant";

    /*
     * oauth2 自带异常错误提示
     */
    public final static String NO_UNSUPPORTED = "Full authentication is required to access this resource";


    /*
     * oauth2 缺少参数grant_type
     */
    public final static String NO_GRANTTYPE = "invalid_request";


    /*
     * jwt_token 存储信息
     */
    public final static String CACHE_TOKEN = "jwt_token:";

    /**
     * 默认租户ID
     */
    public static final Long DEFAULT_TENANT_ID = 0L;

    /**
     * 账号锁定前缀
     */
    public static final String LOCK_ACCOUNT_PREFIX = "LOCK_ACCOUNT:";


    /**
     * 账号API权限存储前缀
     */
    public static final String ACCOUNT_API_PREFIX = "API_ACCOUNT:";
    /**
     * 认证信息Http请求头
     */
    public static final String JWT_TOKEN_HEADER = "Authorization";

}
